#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{

    if (playPCMThread == nullptr) {

        playPCMThread = new PlayPCMThread(this);

        ui->pushButton->setText("暂停");

        connect(playPCMThread,&QThread::finished,this,[this](){


            playPCMThread = nullptr;
            ui->pushButton->setText("播放");
        });

        playPCMThread->start();


    }else {

        playPCMThread->requestInterruption();
    }


}
